feat: strict issuer validation on OIDC Discovery document retrieval #2116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Feature: Implement Issuer Validation for OpenID Connect Discovery document
This PR proposes to enhance the security of
angular-auth-oidc-client
by implementing a validation check for theissuer
field in the OpenID Connect discovery document.Problem:
During a recent internal review, we identified a scenario where a misconfigured reverse proxy could allow a cache poisoning attack. This attack could lead to a modified
.well-known/openid-configuration
payload being served from a malicious domain (e.g.,evil.xyz.com
), even when the configured authority is a legitimate Identity Provider (e.g.,idp.corporate.com
).Currently,
angular-auth-oidc-client
accepts this malicious metadata without validating that theissuer
field within the discovery document matches the expected authority.Proposed Solution:
According to the OpenID Connect Discovery specification (Section 4.3):
This PR aims to implement this crucial validation. By verifying that the
issuer
value returned in the discovery document precisely matches the authority configured in the client, we can provide a significant defense-in-depth layer against cache poisoning and similar attacks.Benefits:
Workaround :
Using the
authWellknownEndpoints
configuration option to explicitly pin the well-known endpoint URLs. However, we believe this check would benefit all users of the library as a standard security measure.